#ifndef __THREAD__
#define __THREAD__
#include<pthread.h>
#include<iostream>
#include<functional>
using std::function;
using std::endl;
using std::cout;

using ThreadCallback = function<void()>;
class Thread{
public:
    Thread(ThreadCallback && cb);
    ~Thread();
    void start();
    void stop();
    //static 没有this指针
    static void* threadFunc(void *args);
private:
    ThreadCallback _cb;
    pthread_t _thid;
    bool isRun;
};
#endif 